home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / diag / dskbuf22.zip / DISKBUF.DOC < prev    next >
Text File  |  1989-11-06  |  23KB  |  608 lines

  1.  
  2.  
  3.                                      DISKBUF
  4.  
  5.                    A Program to Optimize the BUFFERS= Setting
  6.                                  Version 2.20(4)
  7.  
  8.                                        by
  9.  
  10.                                   W. G. Madison
  11.  
  12.  
  13.                                Copyright 1987, '89 
  14.                         W.G. Madison and Associates, Ltd.
  15.                               All rights reserved.
  16.  
  17.  
  18.                                 November 6, 1989
  19.  
  20.  
  21.         NOTICE: The program DiskBuf and this associated documentation are 
  22.         copyrighted products. They may be freely distributed, provided 
  23.         only that both the program and documentation are distributed 
  24.         together, that no modification is made to either the program or 
  25.         the documentation, and that no charge other than a copying charge 
  26.         not to exceed $6.00 is levied on the recipient. Disk distributors 
  27.         may include promotional text with this program, provided that 
  28.         such text appears as a separate file or as text appended to this 
  29.         documentation. If appended to this document, such text must be 
  30.         readily identifiable as to its source and must appear ONLY at the 
  31.         end of the document file. Finally, neither the author nor MADISON 
  32.         AND ASSOCIATES assume any responsibility or liability for actual 
  33.         or consequential damages arising from the use of this program, 
  34.         even if they have been notified in advance of the possibility of 
  35.         occurrence of such damages.
  36.  
  37.         We would like to know of your experience with DiskBuf. Please 
  38.         address any criticisms or comments to:
  39.  
  40.                         W.G. Madison and Associates, Ltd.
  41.                         Consultants / Information Systems
  42.                                   P. O. Box 898
  43.                                Greenbelt, MD 20770
  44.                                   (301)552-7234
  45.                              (CompuServe  73240,342)
  46.  
  47.  
  48.                 * * * * * * * * * * * * * * * * * * * * * * * * *
  49.  
  50.  
  51.         Acknowledgment: Release 1 of this program was based upon ideas 
  52.         gleaned from the public domain program THRASHER, by Monte Fergu-
  53.         son of Ravenna, OH. This release, 2.00(2), has been enhanced as a 
  54.         result of several user suggestions received over the intervening 
  55.         two years. My thanks to all who have contributed.
  56.  
  57.  
  58.  
  59.  
  60.                                    1
  61.  
  62.  
  63.  
  64.         Disclaimer: This program is provided AS IS, with no claim for 
  65.         suitability for any particular purpose. Specifically, since the 
  66.         program is necessarily extremely disk intensive and therefore 
  67.         exercises the head positioning mechanism far more than is custom-
  68.         ary in normal use, the Author and W. G. Madison and Associates, 
  69.         Ltd. disclaim any and all responsibility for actual and/or con-
  70.         sequential damages to hardware and/or files resulting from the 
  71.         use of this program.
  72.  
  73.  
  74.         INTRODUCTION:
  75.  
  76.              All personal computers using the DOS operating system (PC-
  77.         DOS, MS-DOS, etc.) use buffered I/O when reading from or writing 
  78.         to the disk, unless the programmer who wrote the software being 
  79.         used went to great lengths to avoid it. The number of buffers 
  80.         used is specified in the file CONFIG.SYS, which is read at the 
  81.         time the computer is booted up.
  82.  
  83.              If you are not familiar with the CONFIG.SYS file or with the 
  84.         concept of buffered I/O, it is strongly suggested that you refer 
  85.         to your DOS reference manual before proceeding further.
  86.  
  87.              The problem of determining the proper number of buffers with 
  88.         which to configure a DOS computer is, at best, inadequately add-
  89.         ressed in most DOS reference manuals. Generally, the suggested 
  90.         approach is "Try a number, then use your computer, then try 
  91.         another number. Keep repeating this process until you are either 
  92.         fed up or have arrived at something which gives acceptable per-
  93.         formance." Some reference manuals give a suggested value to be 
  94.         used by those looking for an easy out. This suggested value may 
  95.         or may not yield performance which is close to optimum.
  96.  
  97.              DiskBuf provides a method for scanning through an entire 
  98.         range of values while you go out for coffee (or something 
  99.         stronger).
  100.  
  101.  
  102.         WHY WORRY ABOUT THE NUMBER OF BUFFERS?
  103.  
  104.              As might be expected, buffering uses RAM. Specifically, each 
  105.         buffer added to a DOS system uses 33 paragraphs (528 bytes) of 
  106.         RAM. Assuming that plenty of RAM is available, it might be tempt-
  107.         ing to take the approach, "Let's just set the number of buffers 
  108.         way up, and fly with that." Unfortunately, one can reach the 
  109.         point where more time is spent searching buffers for information 
  110.         than is necessary or desirable. A point of diminishing returns is 
  111.         reached.
  112.  
  113.              Similarly, too few buffers will cause the computer to go to 
  114.         the disk more often than necessary. And, since disk operations 
  115.         are dreadfully slow in comparison to memory operations, unaccept-
  116.         able performance degradation will result.
  117.  
  118.  
  119.  
  120.  
  121.                                    2
  122.  
  123.  
  124.  
  125.         WHY USE THE DISKBUF PROGRAM TO SOLVE THE PROBLEM?
  126.  
  127.              Basically, without an intimate knowledge of the insides of 
  128.         DOS plus a penchant for solving complex mathematical problems, 
  129.         there are three feasible methods for attacking the problem. The 
  130.         first is to pick a number (based either upon your liking for 
  131.         indulging in Russian roulette, or upon recommendations from 
  132.         friends or the DOS reference manual) and put your trust in the 
  133.         tooth fairy as to the appropriateness of the number. The second 
  134.         is to try to determine the number by systematic trial and error, 
  135.         editing your CONFIG.SYS file over a period of time. The third 
  136.         method is to set up an automatic process which can sweep through 
  137.         a series of values, perform a realistic test with each value, and 
  138.         record the results for later analysis.
  139.  
  140.              The DISKBUF program permits this third approach to be taken 
  141.         easily. By using DISKBUF, you can readily determine the optimum 
  142.         number of buffers to be used, based not only upon time to perform 
  143.         the test but also upon the amount of RAM occupied by the buffers. 
  144.         You can decide, and have some rational basis for the decision, 
  145.         whether you are willing to sacrifice X bytes of additional RAM in 
  146.         order to gain an additional Y% performance improvement from your 
  147.         disk operations.
  148.  
  149.  
  150.         HOW DO I USE DISKBUF?
  151.  
  152.              CAUTIONARY NOTE: If you are using cache in other than normal 
  153.         memory, under certain circumstances the automatic re-boot will be 
  154.         inhibited; you will have to manually re-boot at the end of each 
  155.         test cycle. No other ill effects seem to occur, however, and the 
  156.         test results appear to be still valid. We have not yet been able 
  157.         to determine the cause or specifically state the exact circum-
  158.         stances under which this will occur.
  159.  
  160.              Nine files are included in the file DISKBUF.ZIP. They are, 
  161.         respectively:
  162.  
  163.                   DISKBUF.DOC    (This file)
  164.                   DISKBUF.EXE    (The operational program)
  165.                   AUTOEXEC.BAT   (A specimen AUTOEXEC file)
  166.                   BUFTST-1.EXE   (One of the two provided test modules. 
  167.                                  This is the test you would probably want 
  168.                                  to use if your typical activity involved 
  169.                                  accessing many files scattered over the 
  170.                                  disk.)
  171.                   BUFTST-2.EXE   (The second of the two provided test 
  172.                                  modules. This is the test you would 
  173.                                  probably want to use if your typical 
  174.                                  activity involved random accessing of a 
  175.                                  relatively few large files.)
  176.                   BUFFTEST.EXE   (A copy of BUFTST-1.EXE. This copy is 
  177.                                  the one which will actually be used in 
  178.                                  testing.)
  179.  
  180.  
  181.  
  182.                                    3
  183.  
  184.  
  185.  
  186.                   PLOTFM.EXE     (A stand-alone program to produce plots 
  187.                                  of figures of merit.)
  188.                   PLOTBUF.COM    (The plot driver program to produce a 
  189.                                  screen plot of the test results. Used by 
  190.                                  both DISKBUF and by PLOTFM. Assumes a 
  191.                                  CGA card. DO NOT ATTEMPT TO RUN PLOTBUF 
  192.                                  AS A STAND-ALONE PROGRAM.) 
  193.                   UPDATE.DOC     (The revision history of DISKBUF.)
  194.  
  195.              Examine the AUTOEXEC.BAT file. You will see, as the last 
  196.         line of the file, the line invoking DISKBUF. In the REMark lines 
  197.         preceding this, you will see guidelines for setting the switch 
  198.         values to be passed to DISKBUF. The switches are:
  199.  
  200.                             /TARGET=     (Sets the disk to be tested)
  201.                             /MAXBUF=     (Sets the stopping point (maxi-
  202.                                          mum number of buffers) for the 
  203.                                          test)
  204.                             /MINBUF=     (Sets the starting point (mini-
  205.                                          mum number of buffers) for the 
  206.                                          test)
  207.                             /PLOT        (If present, a screen plot of 
  208.                                          the test results will be pro-
  209.                                          duced)
  210.  
  211.              The first two switches, /TARGET= and /MAXBUF= are required; 
  212.         the other two, /MINBUF= and /PLOT are optional.
  213.  
  214.              /TARGET=xx     takes as an argument a valid disk device 
  215.         designator, with the appended colon being optional. This deter-
  216.         mines the device or partition which is to be tested. (Required)
  217.  
  218.              /MAXBUF=nn     takes as an argument an integer between 1 and 
  219.         99, and determines the greatest number of buffers to be used in 
  220.         the test. (Required)
  221.  
  222.              /MINBUF=nn     also takes as an argument an integer between 
  223.         1 and 99, and determines the starting number of buffers to be 
  224.         used in the test. If this switch is omitted, a starting value of 
  225.         3 will be used. (Optional)
  226.  
  227.              /PLOT          determines by its presence or absence whether 
  228.         or not a screen plot of the test results will be produced at the 
  229.         completion of the test. NOTE: If your computer does not have a 
  230.         graphics card, this switch must not be included! (Optional)
  231.  
  232.  
  233.              To use DISKBUF, the following steps are required.
  234.  
  235.              STEP 1.   Format a floppy disk using the /S switch to make 
  236.         the disk bootable.
  237.  
  238.              STEP 2.   Edit the AUTOEXEC.BAT file provided with the 
  239.         DISKBUF distribution set, to invoke DISKBUF with the switch set-
  240.         tings you want used.
  241.  
  242.  
  243.                                    4
  244.  
  245.  
  246.  
  247.  
  248.              STEP 3.   Copy the edited AUTOEXEC.BAT file and the program 
  249.         file DISKBUF.COM onto the disk prepared at Step 1.
  250.  
  251.              STEP 4.   Copy your own CONFIG.SYS file onto the disk 
  252.         prepared at Step 1. If necessary, edit the CONFIG.SYS to make 
  253.         sure that the BUFFERS= parameter is ***OUTSIDE*** the range 
  254.         determined by the MAXBUF= and MINBUF= parameters in the 
  255.         AUTOEXEC.BAT file. (For that matter, if you simply delete the 
  256.         BUFFERS= line from the CONFIG.SYS file, DISKBUF will manage it 
  257.         appropriately.)
  258.  
  259.              STEP 5.   Copy any device drivers to be installed by the 
  260.         CONFIG.SYS over to the floppy. Do the same for any resident 
  261.         programs to be installed by the AUTOEXEC.BAT.
  262.  
  263.              STEP 6.   Copy DISKBUF.EXE to the floppy. If /PLOT is 
  264.         selected in the AUTOEXEC.BAT, copy PLOTBUF.COM and, optionally, 
  265.         PLOTFM.EXE to the floppy.
  266.  
  267.              STEP 7.   Decide, based on the descriptions given above, 
  268.         which of the two test modules you wish to use. Copy the desired 
  269.         module to the floppy as BUFFTEST.EXE using the DOS COPY command. 
  270.         (For the average user, we believe that BUFTST-1.EXE more nearly 
  271.         reflects typical usage; it is therefore the one already set up.)
  272.  
  273.              STEP 8.   Re-boot your computer.
  274.  
  275.              STEP 9.   Go to lunch, and come back in an hour or so. 
  276.         (Optional)
  277.  
  278.  
  279.              When the test is completed, a new file will be on the 
  280.         floppy disk:
  281.  
  282.                   BUFFERS.RPT contains the test results, giving for each 
  283.                               number of buffers tested a figure of merit 
  284.                               and the minimum requirement of RAM (in 
  285.                               bytes) for DOS (given the set of device 
  286.                               drivers and resident programs present dur-
  287.                               ing the test.)
  288.  
  289.  
  290.              The figure of merit for a given number of buffers is propor-
  291.         tional to the time required for the test. Thus, SMALLER is 
  292.         BETTER. The minimum figure of merit is the one you want (ignoring 
  293.         the amount of space occupied by the buffers).
  294.  
  295.              Note that, if /PLOT was selected, the screen plot only dis-
  296.         plays a limited range of the figure of merit values. Specific-
  297.         ally, the range displayed is from the minimum figure of merit to 
  298.         5% greater than this value. All figures of merit greater than 
  299.         this are clipped at this level for plotting purposes. This was 
  300.         done in order to better present the detail of the values only 
  301.         slightly worse than the minimum value.
  302.  
  303.  
  304.                                    5
  305.  
  306.  
  307.  
  308.  
  309.              The screen plot may be recreated at any time by running 
  310.         PLOTFM. The only restriction is that the file BUFFERS.RPT and 
  311.         PLOTBUF.COM must be in the current disk and directory. 
  312.  
  313.              Should you wish to test against two different disks or re-
  314.         test a disk using two different tests, the file BUFFERS.RPT must 
  315.         be copied or renamed before the second test is conducted. If this 
  316.         is not done, the files will be over-written and the results of 
  317.         the earlier test will therefore be lost.
  318.  
  319.              Should you wish to re-test the disk using the other provided 
  320.         test, simply return to Step 7 above and proceed from there. It 
  321.         will not be necessary to edit the CONFIG.SYS file, since (unless 
  322.         you are also increasing the MAXBUF= setting in the AUTOEXEC.BAT 
  323.         file) the BUFFERS= setting is guaranteed to be outside the 
  324.         testing range.
  325.  
  326.  
  327.         CAN I INCLUDE A DOS SIZE CONSIDERATION IN THE FIGURE OF MERIT?
  328.         RUNNING PLOTFM.
  329.  
  330.              As mentioned above, the calculated figure of merit is pro-
  331.         portional to the time required to run the test. In most cases, it 
  332.         is felt that this is an appropriate indicator.
  333.  
  334.              We recognize, however, that there may be installations in 
  335.         which RAM is critical. For these installations, or if you just 
  336.         want to re-display the results of an earlier test, the module 
  337.         PLOTFM.EXE is provided.
  338.  
  339.              PLOTFM.EXE accepts one required and two optional command 
  340.         line parameters. 
  341.  
  342.                PLOTFM <rpt-file> [<time-weight> [<space-weight>]]
  343.  
  344.              <rpt-file> is the name of the DISKBUF output file to be 
  345.         used. If no extension is provided, .RPT is assumed.
  346.  
  347.              <time-weight> is the relative weight to be given to the time 
  348.         variable in the calculation of figure of merit.
  349.  
  350.              <space-weight> is the relative weight to be given to the 
  351.         space variable (i.e., DOS paragraphs) in the calculation of 
  352.         fighre of merit.
  353.  
  354.              If the two weight factors are omitted from the command line, 
  355.         the plot produced at the completion of testing will be repro-
  356.         duced. (<time-weight> defaults to 1; <space-weight> defaults to 
  357.         0).
  358.  
  359.              Thus, the following are equivalent:
  360.  
  361.                                  PLOTFM TEST-A
  362.  
  363.  
  364.  
  365.                                    6
  366.  
  367.  
  368.  
  369.                                  PLOTFM TEST-A.RPT
  370.  
  371.                                  PLOTFM TEST-A 1 0
  372.  
  373.                                  PLOTFM TEST-A.RPT 1
  374.  
  375.         and each will produce the same plot display as that produced at 
  376.         the conclusion of the DISKBUF test run.
  377.  
  378.              We have found that many installations will wish to take 
  379.         space into account, but not very heavily. In nearly all cases, 
  380.         basing BUFFERS= settings on plots produced with time weights 20 
  381.         to 30 times greater than the space weight seems appropriate. 
  382.  
  383.              Should RAM be an **EXTREMELY** scarce resource for you, you 
  384.         might wish to examine the display produced with a time weight as 
  385.         small as 5 times the space weight.
  386.  
  387.              In calculating the figure of merit, both the time and space 
  388.         factors are normalized; each time factor is divided by the mini-
  389.         mum observed time factor and each space factor is divided by the 
  390.         minimum observed space factor. The normalized factors are then 
  391.         multiplied by the appropriate weight, and the weighted factors 
  392.         are added. This sum is then divided by the sum of the weights to 
  393.         give a normalized figure of merit. Finally, this normalized fig-
  394.         ure of merit is multiplied by the minimum observed time factor to 
  395.         yield the actual figure of merit. 
  396.  
  397.              
  398.  
  399.  
  400.         HOW CAN I DESIGN MY OWN TEST MODULES?
  401.  
  402.              Two fundamentally different test modules are provided which 
  403.         represent quite different testing scenarios. 
  404.  
  405.              BUFTST-1.EXE examines the directory entry for each file in 
  406.         every directory on the disk being tested. Thus, it simulates a 
  407.         situation in which the user is accessing many files in any given 
  408.         session.
  409.  
  410.              BUFTST-2.EXE writes a single large (1000 record, 100 bytes 
  411.         per record) file in the root directory of the target disk. It 
  412.         then interchanges record 1 with record 1000, record 2 with record 
  413.         999, etc. Having completed this sub-test, it then interchanges 
  414.         record 1 with record 2, record 2 with record 3, ... record 999 
  415.         with record 1000. Thus, it simulates both sequential and random 
  416.         usage of large files.
  417.  
  418.              You are free to generate your own tests as you will. These 
  419.         tests can be implemented in either executable (.EXE or .COM) 
  420.         files, or in batch control (.BAT) files. In either case, the file 
  421.         name **must** be BUFFTEST (i.e., BUFFTEST.COM, BUFFTEST.EXE, or 
  422.         BUFFTEST.BAT). The test module must expect a single command line 
  423.         parameter of the form <d>:\ where <d> is the drive letter of the 
  424.  
  425.  
  426.                                    7
  427.  
  428.  
  429.  
  430.         drive to be tested. 
  431.  
  432.              One word of caution. It is important that the operations 
  433.         being performed be exactly duplicated from run to run, if the 
  434.         output data are to accurately reflect your system behavior. Thus 
  435.         if you have, e.g., put together a batch file (BUFFTEST.BAT) which 
  436.         performs a MAKE, it is important that you recognize ahead of time 
  437.         just which files will be created as a result of the MAKE, and 
  438.         delete them prior to terminating your BUFFTEST.BAT.
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.                                    8
  488.  
  489.  
  490.  
  491.         HOW DOES DISKBUF DO ALL THAT GOOD STUFF?
  492.  
  493.              When DISKBUF is invoked, it performs the following 
  494.         steps:
  495.  
  496.              STEP 0.   Read and parse command tail. Set operating par-
  497.              ameters, based on the contents of the command tail.
  498.  
  499.              STEP 1.   Edit the file CONFIG.SYS on the floppy disk.
  500.  
  501.                   STEP 1A.   If the BUFFERS= line is present, read it to 
  502.                   extract the current BUFFERS=  setting. 
  503.  
  504.  
  505.                        STEP 1A1. If this setting is not between MINBUF 
  506.                        and MAXBUF then re-write CONFIG.SYS with a 
  507.                        BUFFERS=  setting equal to the value of MINBUF, 
  508.                        and go to STEP 1C.
  509.  
  510.                        STEP 1A2. If the setting is between MINBUF and 
  511.                        MAXBUF then go to STEP 2.
  512.  
  513.                   STEP 1B.  If not present, append a BUFFERS= statement 
  514.                   with a BUFFERS= setting equal to the value of MINBUF.
  515.  
  516.                   STEP 1C.  Delete the BUFFERS.RPT file if it is pres-
  517.                   ent, and re-boot the system.
  518.  
  519.              STEP 2.   Start the timer. 
  520.  
  521.              STEP 3.   Perform the selected test.
  522.  
  523.              STEP 4.   Stop the timer.
  524.  
  525.              STEP 5.   Calculate the figure of merit, and append a record 
  526.              to BUFFERS.RPT.
  527.  
  528.              STEP 6.   Check the current setting of BUFFERS= against the 
  529.              value of MAXBUF.
  530.  
  531.                   STEP 6A.  If buffer setting < MAXBUF, re-edit the 
  532.                   existing CONFIG.SYS file, incrementing the buffer set-
  533.                   ting and re-boot the system.
  534.  
  535.                   STEP 6B.  Otherwise, the test is completed. 
  536.  
  537.                        STEP 6B1. Leave the CONFIG.SYS file on the floppy 
  538.                        disk with a BUFFERS= setting at MAXBUF + 1.
  539.  
  540.                        STEP 6B2. If /PLOT is selected, plot the test 
  541.                        results.
  542.  
  543.                        STEP 6B3. Exit to DOS.
  544.  
  545.  
  546.  
  547.  
  548.                                    9
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.  
  602.  
  603.  
  604.  
  605.  
  606.                                    10
  607.  
  608.